//
//  AddNameViewController.m
//  jiyujiaProgram
//
//  Created by Jame on 15/10/27.
//  Copyright © 2015年 中良 赵. All rights reserved.
//

#import "AddNameViewController.h"

@interface AddNameViewController () <UITextFieldDelegate>

@end

@implementation AddNameViewController
{
    UITextField *_textField;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self creatNavigationBarWithImage:nil title:@"课程名称"];
    [self creatNavigationBarLeftItemWithLeftTitle:nil LeftImage:ECIMAGENAME(@"back_button.png")];
    [self creatNavigationBarRightItemWithRightTitle:@"确定" RightImage:nil];
    
    [self creatTextField];
}

- (void)leftBtnClick:(id)leftSender
{
    [self.navigationController popViewControllerAnimated:YES];
}


- (void)rightBtnClick:(id)rightSender
{
    [self.navigationController popViewControllerAnimated:YES];
    if (self.addName) {
        self.addName(_textField.text);
    }

}


- (void)creatTextField
{
    _textField = [[UITextField alloc] initWithFrame:CGRectMake(10, 64 + 10, ECSCREEN_W - 20, 35)];
    _textField.delegate = self;
    _textField.borderStyle = UITextBorderStyleRoundedRect;
    _textField.placeholder = @"请输入课程名称";
    _textField.textColor = [UIColor blackColor];
    _textField.font = [UIFont systemFontOfSize:14.f];
    _textField.clearsOnBeginEditing = YES;
    [self.view addSubview:_textField];
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [_textField resignFirstResponder];
    return YES;
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    [_textField resignFirstResponder];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
